package com.xfp.controller;


import com.xfp.pojo.dto.ChannelConfigDto;
import com.xfp.pojo.entity.Channel;
import com.xfp.pojo.vo.ChannelVo;
import com.xfp.service.ChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api/vm-service/channel")
@Api("货道管理")
public class ChannelController {

    @Autowired
    private ChannelService channelService;

    @GetMapping("/channelList/{innerCode}")
    @ApiOperation("获取售货机货道详情")
    public List<Channel> channelList(@PathVariable String innerCode){
        log.info("获取售货机货道详情：{}",innerCode);
        List<Channel> list = channelService.channelList(innerCode);
        return list;
    }

    @PutMapping("/channelConfig")
    @ApiOperation("货道配置")
    public Boolean channelConfig(@RequestBody ChannelConfigDto dto){
        log.info("货道配置:{}",dto);
        channelService.config(dto);
        return true;
    }

}
